<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">

<ui:composition template="template/template.xhtml">
	<ui:define name="content">
		<h1>Company Reports</h1>
		<h:form id="companyReports" styleClass="horizontal_full">
			
			<p>
				On this page you have access to you previous bought reports. That could be 
				reports of the whole market or also spying reports. A spying report is a report 
				with information about a specific competitor.
			</p>	
			
			<p:dataTable id="compRoundReportsBought" var="repDec"
				value="#{reportMBean.reportDecisions}" selectionMode="single"
				rowKey="#{repDec.id}"
				paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}"
				rowsPerPageTemplate="10,25,50,100" paginator="true" rows="10">

				<f:facet name="header">
					            Available Reports
					        </f:facet>

				<p:column headerText="Show report">
					<p:commandButton icon="ui-icon-search" title="Show Report"
						action="#{reportMBean.actionGenerateReport}">
						<f:setPropertyActionListener value="#{repDec}"
							target="#{reportMBean.selectedRepDec}" update="reportForm" />
					</p:commandButton>
				</p:column>

				<p:column headerText="Round number"
					sortBy="#{repDec.getRoundNumber()}">
					<h:outputText value="#{repDec.getRoundNumber()}" />
				</p:column>

				<p:column headerText="Report type"
					sortBy="#{repDec.report.reportTypeName}">
					<h:outputText value="#{repDec.report.reportTypeName}" />
				</p:column>

				<p:column headerText="Report price"
					sortBy="#{repDec.report.reportPrice}">
					<h:outputText value="#{repDec.report.reportPrice}" />
				</p:column>
				
				<!--  
				<p:column headerText="Target company"
					sortBy="#{reportMBean.getCompetitorName(repDec.targetCompany_Id)}">
					<h:outputText
						value="#{reportMBean.getCompetitorName(repDec.targetCompany_Id)}" />
				</p:column>
				-->

			</p:dataTable>

		</h:form>

	</ui:define>
</ui:composition>

</html>